package com.ymttest.database.sqlwapper;

import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.YmtSellerSubAccountRelated;

public class YmtSellerSubAccountRelatedIMapper {
	SqlManager manage;

	public YmtSellerSubAccountRelatedIMapper() {
		manage = new SqlManager("YmtSellerinfo");
	}
	/*
	 * 根据主账号ID查询子账号信息
	 */
	public List<YmtSellerSubAccountRelated> selectSubAccountRelatedSellerId(Integer sellerId) throws InterruptedException {
	    @SuppressWarnings("unchecked")
	    List<YmtSellerSubAccountRelated>  sellerids = manage.getSelectResults(
	            "com.ymttest.database.mapping.YmtSellerSubAccountRelatedMapper.selectSubAccountRelatedSellerId", sellerId);
	    manage.commit();
	    return sellerids;
	}
	

	/* * 根据主账号ID查询子账号信息且状态为0*/
	 
	public List<YmtSellerSubAccountRelated> selectSubAccountRelatedSellerIds(Integer sellerId) throws InterruptedException {
	    @SuppressWarnings("unchecked")
	    List<YmtSellerSubAccountRelated>  sellerids = manage.getSelectResults(
	            "com.ymttest.database.mapping.YmtSellerSubAccountRelatedMapper.selectSubAccountRelatedSellerIds", sellerId);
	    manage.commit();
	    return sellerids;
	}
	
	/*
	 * 根据子账号ID查询子账号信息
	 */
	public List<YmtSellerSubAccountRelated> selectSubAccountRelatedSubsellerUserid(Integer sellerSubAccountUserid) throws InterruptedException {
	    @SuppressWarnings("unchecked")
	    List<YmtSellerSubAccountRelated>  sellerids = manage.getSelectResults(
	            "com.ymttest.database.mapping.YmtSellerSubAccountRelatedMapper.selectSubAccountRelatedSubsellerUserid", sellerSubAccountUserid);
	    manage.commit();
	    return sellerids;
	}
	
	/*
	 * 根据子账号ID查询子账号信息
	 */
	public List<YmtSellerSubAccountRelated> selectSubAccountRelatedsellersubaccount(String subSellerName) throws InterruptedException {
	    @SuppressWarnings("unchecked")
	    List<YmtSellerSubAccountRelated>  sellerids = manage.getSelectResults(
	            "com.ymttest.database.mapping.YmtSellerSubAccountRelatedMapper.selectSubAccountRelatedsellersubaccount", subSellerName);
	    manage.commit();
	    return sellerids;
	}

	/*
	 * 根据主账号ID查询子账号信息
	 */
	public int deleteSubAccountRelatedsubSellerName(String subSellerName) throws InterruptedException {
	    @SuppressWarnings("unchecked")
	    int result = manage.delete("com.ymttest.database.mapping.YmtSellerSubAccountRelatedMapper.deleteSubAccountRelatedsubSellerName", subSellerName);
	    manage.commit();
	    return result;
	}
}
